package org.teamh.logic.datamodel;

import java.util.HashMap;


public class CreepTypeToCreepMapping {

	private Guide guide;
	private HashMap<String, CreepDescription> creepDescriptions = new HashMap<String, CreepDescription>();
	private String name;
	private String ID;

	public CreepTypeToCreepMapping(String ID) {
		this.ID = ID;
	}
	
	public void setGuide(Guide guide) {
		if(this.guide != guide) {
			if(getGuide() != null) {
				getGuide().removeCreepTypeToCreepMapping(this);
			}
			this.guide= guide;
			if(getGuide() != null) {
				getGuide().addCreepTypeToCreepMapping(this);
			}
		}
	}
	
	public Guide getGuide() {
		return guide;
	}
	
	public void addCreepDescription(CreepDescription creepDescription) {
		if(!creepDescriptions.containsKey(creepDescription.getID())) {
			creepDescriptions.put(creepDescription.getID(), creepDescription);
			creepDescription.setCreepTypeToCreepMapping(this);
		}
	}
	
	public void removeCreepDescription(CreepDescription creepDescription) {
		if(creepDescriptions.remove(creepDescription.getID()) != null) {
			creepDescription.setCreepTypeToCreepMapping(null);
		}
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getID() {
		return ID;
	}

	public void setID(String ID) {
		this.ID = ID;
	}
	
	public CreepDescription getCreepDescription(String ID) {
		return creepDescriptions.get(ID);
	}
	
}
